export enum HttpStates {
  RESERROR = 400, //请求错误
  UNAUTHORIZED = 401, //未授权
  ACCESSDENIED = 403, // 拒绝访问
  ADDRESSERROR = 404, //地址错误
  REQUESTTIMEOUT = 408, //请求超时
  SERVERERROR = 500, //服务器内部错误
  SERVICENO = 501, //服务未实现
  BADGATEWAY = 502, // 网关错误
  SERVICENOTAV = 503, //服务不可用
  GATEWAYTIMEOUT = 504, //网关超时
  HTTPVERSIONNO = 505 //HTTP版本不受支持
}

export enum Methods {
  GET = 'GET',
  POST = 'POST',
  FORMDATE = 'FORMDATE',
  MOVE = 'DELETE',
  PUT = 'PUT'
}

interface SuccessData {
  code: string | number
  message: string
  [propName: string]: any
}

export type ResponseSuccessFun = SuccessData | Promise<Request.RequestResult>
export type SuccessCallbackResult = Taro.request.SuccessCallbackResult<SuccessData>

export interface ApiOptions {
  name: string
  method: string
  desc: string
  path: string
  mockPath: string
  params: {
    [propName: string]: string | number | boolean
  }
}

export interface AllApiinterface {
  [propName: string]: Array<ApiOptions>
}

export interface OuterParams {
  [propName: string]: any
}

export interface OuterOptions {
  header?: any
  noShowLoading?: boolean
  noShowDefaultError?: boolean
  path?: string
  desc?: string
  host?: string
}

export interface ModoifyData extends OuterOptions {
  data: OuterParams
  url: string
}
